export default {
    namespaced:true,
    actions:{
       odd(miniStore,value){
           console.log("odd执行",miniStore,value)
           if(miniStore.state.sum%2){
               miniStore.commit("ODD",value)
           }
       },
       wait(miniStore,value){
           console.log("wait执行",miniStore,value)
           setTimeout(() => {
               miniStore.commit("WAIT",value)
           }, 500);
       },
   },
   // 准备mutations 用于操作数据 state
   mutations :{
       JIA(state,value){
           console.log("JIA执行")
           state.sum+=value
       },
       JIAN(state,value){
           console.log("JIAN执行")
           state.sum-=value
       },
       ODD(state,value){
           console.log("ODD执行")
           state.sum+=value
       },
       WAIT(state,value){
           console.log("WAIT执行")
           state.sum+=value
       },
       
   },
   // 准备state 用于存储数据
   state :{
       sum:0,
       school:"尚学堂",    
       subject:"前端",
   },
   
   //对state数据 针对逻辑复杂的进行计算 有点类似于 computed,对于commuted可以跨组件复用
   getters:{
       bigSum(state){
           return state.sum*10;
       }
   }
}